import {jwt} from "jsonwebtoken"

const auth = (req, res, next) => {
  try {
    // header: authorization <the token string here is what I need>
    const token = req.headers.authorization.split(" ")[1]
    console.log(token)
    const verify = jwt.verify(token, "this is dummy text")
    next()
  } catch(err) {
    res.status(401).json({
      msg: "Invalid token"
    })
  }
}
